package cn.wolfcode.enums;

import lombok.Getter;

@Getter
public enum RedisKey {
    EMPLOYEE_PERMISSION("employee_permission",30 * 60);

    private String prefix;
    private int time;
    //使用有参构造器初始化成员变量
    RedisKey(String prefix, int time){
        this.prefix = prefix;
        this.time = time;
    }
    //提供方法调用redis中的key值
    public String getKey(String ...keys ){
        StringBuilder sb = new StringBuilder(100);
        sb.append(prefix);
        for (String key : keys) {
            sb.append(":");
            sb.append(key);
        }
        return sb.toString();
    }
}
